

<div class="section-content"  id="blog-section-content">
	<div class="row row-section-content" id="blog-section-content">
		<div class="col-md-12 col-xs-12 col-sm-12 left" id="blog-section-left">
        
        
			<div class="my-panel blog-detail-panel">
				<div class="panel-title blog-detail-title" id="blog-detail-main-title">
					<h1 class="pull-left"><a href="<?php echo blog_url_item($data['id'],$data['alias']) ?>"><?php echo $data['name'];?></a></h1>
					<p class="date-created pull-right"><?php echo $data['upload_time'];?></p>
					<div class="clr"></div>
				</div>
                
				<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumb video_breadcrumb">
					<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo HOME ?>"><i class="fa fa-home"></i></a></li>
					<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo HOME ?>blog">Blog</a></li>
					<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo $data['category']['main']['url']; ?>"><?php echo $data['category']['main']['name']; ?></a></li>
					<?php if($data['sub']!=''){
							 	if($data['category']['sub']){?>
					<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo $data['category']['sub']['url']; ?>"><?php echo $data['category']['sub']['name']; ?>
					</a></li>
					<?php } 
}?>

				</ul>

				<!-- Content Main Post-->
                <?php 
				
				if(  (isset($_GET['page'])&&$_GET['page']==1) ||  !isset($_GET['page']) ){?>
				<div class="panel-title blog-detail-user-title">

					<a class="blog-title-avatar" href="<?php echo blog_url_user($data['user']['username']);?>"><img
						src="<?php echo user_avatar($data['user']['avatar']) ?>" alt="" /> </a>
					<div class="blog-title-user-info">
						<div class="pull-left">
                           	 <p class="blog-title-username">
                <a href="<?php echo blog_url_user($data['user']['username']); ?>"><?php echo show_username($data['user']['username'],$data['user']['name']); ?></a>
                           	 </p>
                              <p class="status">	
                              		<i class="fa fa-quote-left"></i> <em> <?php if($data['user']['slogan']!=''){ echo $data['user']['slogan'];}else{ echo "No Status";} ?> </em><i class="fa fa-quote-right"></i>
                               </p>
						</div>
                        
                        <div class="pull-right">
                                <p>
                                    <i class="fa fa-clock-o"></i> Ngày tham gia:
                                    <?php echo $data['user']['date_registered']; ?>
                                </p>
                        </div>
                        <div class="clearfix"></div>
					</div><!-- End blog-title-user-info -->

				</div> <!-- End panel-title blog-detail-user-title -->


				<div class="blog-each-section">
                		<div class="content_edit">
					<?php echo BBCode::parse($data['content']); ?>
                    	</div>
 
					<div class="manage-blog">
					<div class="addthis_native_toolbox" style="text-align:center"></div>
                       <?php if($data['update_time']!='' && $data['update_user']){
						   $re=get_user_by_username($data['update_user']);
						   ?>
                    	<p class="pull-left blog_update_infor">
                        		Cập Nhật lần cuối bởi <b><?php echo show_username($re['username'],$re['name']) ?></b> vào <em><?php echo time_ago($data['update_time']);?></em>
                        </p>
                        <?php }?>
						<!-- Single button -->
                          <?php if(isset($_SESSION['user']))
						  		if($_SESSION['user']['username']==$data['uploader_user'] || $_SESSION['user']['level']==1|| $_SESSION['user']['level']==6){ ?>
						<div class="btn-group pull-right">
							<button type="button" class="btn btn-fresh btn-xs dropdown-toggle"
								data-toggle="dropdown" aria-expanded="false">
								<i class="fa fa-cog"></i> Quản lý bài viết <span class="caret"></span>
							</button>
                          
							<ul class="dropdown-menu" role="menu">
								<li><a href="<?php echo HOME;?>index.php?module=manage&act=blog&opt=post&pid=<?php echo $_GET['id'] ?>" target="_blank"><i class="fa fa-pencil-square-o"></i> Quản Lý Bài Viết</a></li>
							</ul>
						</div>
                        <?php }?>
						<div class="clr"></div>
					</div>
                    <!-- Panel Footer -->
                    <?php if($data['user']['chuky']!=''){?>
                    <div class="blog_footer_chuky">
                  	<?php   echo BBCode::parse($data['user']['chuky']); ?>
                    </div>
                    <?php }?>
                    <!-- Panel Footer -->
				</div>
				<!-- /.panel-featured-row -->
                <?php } //End show content main post if get['page']?>
				<!-- End content Main post -->
			
				<div class="clr"></div>
			</div> <!-- blog-detail-panel -->
			
            	<div id='paging_content'>
				<?php 
				 echo $data['comment']['nav'];
				if($data['comment']['info']){
						$url=blog_url_item($data['id'],$data['alias']);
						echo blog_render_comment_ajax($data['comment']['info'],$data['upload_user'],$url);
				 }
				 
				 echo $data['comment']['nav'];
				 ?>
				</div>
				
                <div style="height:10px"></div>
                		<div style="background-color:#fff; padding:5px">
		   <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'truyencuatui'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
 
    </div>
            <div style="height:10px"></div>      
                
                
                
                
                
				<div style="background-color: #fff;">
					<div class="panel-title blog-detail-title"
						id="blog-detail-main-title">
						<h1 class="pull-left">Trả Lời</h1>

					</div>

					<div class="wrap-text-editor">
						<blockquote style="border-left: #FC0 3px solid">
							<small><i class="fa fa-warning"></i> Phải đăng nhập thành viên
								mới sử dụng được chức năng này</small>
						</blockquote>
						<input type="text" class="form-control blog-title-input"
							placeholder="Tiêu đề" id="blog_comment_tieude" />
						<textarea placeholder="Content"
							class="blog-content-textarea form-control"
							id="blog_comment_content"></textarea>
						<div style="display: none">
							<input type="text" class="form-control blog-title-input"
								placeholder="Tiêu đề" id="blog_comment_conten" />
						</div>
						<Br />
						<button class="btn my-btn btn-hot" id="blog_comment_submit">Đăng
							bài</button>
					</div>

					<div style="height: 20px"></div>
				</div>
				<!-- End background #fff -->





		</div>
		<!-- /.left -->

	<?php /*
		<div class="col-md-4 col-xs-12 col-sm-12" style="display:none">
			<div class="right-section" id="blog-popular-item">
				<div class="right-title">
					<span class="video-panel-title-a">Bình luận</span>

				</div>
				<div class="right-content" id="right-content-popular-mem">
					<div class="fb-comments" data-href="<?php echo blog_url_item($data['id'],$data['alias']); ?>" data-width="100%" data-numposts="15" data-colorscheme="light"></div>
				</div>
				<!-- /.right-content -->


			</div>
			<!-- /#right-comment -->

				<div class="right-section" id="right-top">
								
									<div class="right-title">
										<span class="right-title-span">Truyện Tranh</span>
										<span class="right-title-span-after"></span>
									</div><!-- /.right-title -->
									
									<div class="right-content">
										<div role="tabpanel" class="right-wrap-tab" id="bxh-tabs">
											<div class="right-wrap-tabs">
												<ul class="nav nav-pills">
													<li role="presentation" class="active"><a data-toggle="tab" href="#via-day">Đề cử</a></li>
													<li role="presentation"><a data-toggle="tab" href="#via-week">Top ngày</a></li>
													<li role="presentation"><a data-toggle="tab" href="#via-month">Top tuần</a></li>
												</ul>
											</div>
											
											<div class="tab-content">
												<div class="tab-pane active fade in" id="via-day">
													  <?php  echo manga_render_group_item_pick();?>       
      												<div class="clr"></div>
												</div>
												<div class="tab-pane fade in" id="via-week">
													<?php echo mangaf2_get_view_day(); ?>
												</div>
												<div class="tab-pane fade in" id="via-month">
													<?php echo mangaf2_get_view_week();?>
												</div>
											</div><!-- /.tab-content -->
										</div><!-- /#bxh-tabs -->
									
                                    </div><!-- /.right-content -->
								
							</div><!-- /.right-section /#right-top -->	



		</div>

		<!-- RIGHT -----------------------------------------------  -->
	*/ ?>
	</div>
	<!-- /#video-section-content -->
</div>
<!-- /.section-content -->
	<script type="text/javascript" src="<?php echo HOME ?>public/exts/editors/tinymce/tinymce.min.js"></script>
	<script type="text/javascript">
	function ajax_pagination(page){
			$.ajax({
			url : "<?php echo blog_url_item($data['id'],$data['alias']); ?>",
	    	type : 'POST',
	    	
				//exit();
    		data : {
				page :page,
				ajax_pagination: 1,
				url:'<?php echo blog_url_item($data['id'],$data['alias']); ?>'
			},
    		
			success: function(data, textStatus, jqXHR){
	
			$('#paging_content').html(data);
				
		  },
		  cache: false
	
		});
		
		
		
	}
	
	$(document).ready(function(){
		
		//location.reload();
		 
		//document.body.scrollTop = document.documentElement.scrollTop = 0;
		var blogCommentHash = window.location.hash.substring(1);
		
		if(blogCommentHash){
			if(blogCommentHash.indexOf('c') != -1){
				idComment = window.location.hash.substring(2);
				
			}
			commentViewWrapper = $('#comment-'+idComment);
			topOffset = commentViewWrapper.offset().top - 10;
			var s = setTimeout(function(){
				$('html, body').animate({
			        scrollTop: topOffset
			    }, 1000);
			}, 500);
			var i = setTimeout(function(){
		    	
		    	commentViewWrapper.css('box-shadow', '0').css('transition', 'box-shadow 2s').css('box-shadow', '0px 0px 40px #336699');
		    	var ii = setTimeout(function(){
		    		commentViewWrapper.css('transition', 'box-shadow 2s').css('box-shadow', '0px 0px 0px');
		    		
			    }, 300);
		    	
			}, 1500);
		}
		
		tinymce.init({
			selector : '#blog_comment_content',
			 plugins : "advlist,autolink,lists,link,image,charmap,print,preview,table,image,fullscreen,code,paste,medialink,mediaurl,picasa_blog",
		  toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image print preview media | forecolor backcolor emoticons code fullscreen,paste | medialink,mediaurl | picasa_blog",
		  height:150,	paste_auto_cleanup_on_paste : true,
		paste_strip_class_attributes:false,
		paste_remove_styles:true,
		force_p_newlines : false,
		force_br_newlines :false,
	    //  extended_valid_elements : "img[src|class|style],table[style|thead|tbody|tfoot|tr|td],div[style],p[style],ul[style],span[style],td[style],br",
	//	invalid_elements : "script,marquee,iframe,object,a" ,
	    extended_valid_elements : "table[style|thead|tbody|tfoot|tr|td|class],div[style],p[style],ul[style],span[style],td[style],br,img[src|class|style]",
		invalid_elements : "script,marquee,iframe,object,a" ,
	
		valid_child_elements : "strong/b/p/div/em/i/td[#text]",
		entity_encoding : "raw",
	    theme_advanced_resizing :true,
    	convert_urls: false
		}); //eND INIT TINYMCE
	
	


	 $('#blog_comment_submit').on('click', function(e){
		 e.preventDefault();
		 var ct2=$('#blog_comment_conten').val();
		 var tieude2=$('#blog_comment_tieude').val();
		 var content2=tinyMCE.get('blog_comment_content').getContent();
		 if(content2==''){ alert("Xin vui lòng nhập nội dung trả lời"); return false;}
		 tinyMCE.get('blog_comment_content').setProgressState(true);
		$.ajax({
			url : "index.php",
	    	type : 'POST',
	    	
				//exit();
    		data : {
				
				module: 'ajax',
				act: 'blog',
				opt : 'comment',
				action: 'add-comment',
				verify_key:'<?php echo sha1(sha1(date('U'))); ?>',
				blog_id:<?php echo $_GET['id'];?>,
	    		ct:ct2,
				content:content2,
				tieude:tieude2
    		},
    		
			success: function(data, textStatus, jqXHR){
				
			  // tinyMCE.get('chuong_content').setProgressState(false);
			 // var data2=tinyMCE.get('chuong_content').getContent();
			// tinyMCE.get('chuong_content').setContent(data2+data);
				if(data){
					newdata = $.parseJSON(data);
					if(newdata.type == 'success'){
						if(newdata.page == "<?php echo $_GET['page']; ?>"){
							
							window.location.reload(true);
							window.location.assign(newdata.redirect_link); 
							
						}
						//alert(newdata.redirect_link);
						//return false;
						else{
							window.location.assign(newdata.redirect_link); 
						}
						return false;
					}else if(newdata.type == 'error'){
						errorMessageSignin = '<div class="alert alert-danger">'+newdata.message+'</div>';
						//btns = [{btnName:'Hoàn tất', btnClass:'btn-primary', btnId:'', btnOnClick: ''}];
						//btnsArray = popupFuncButtons(btns);
						popupFunc("popup-error-comment", "Lỗi", errorMessageSignin, '');
					}
					return false;
				}
				//var progressState = setTimeout(function(){tinyMCE.get('blog_comment_content').setProgressState(false);}, 2000);
			
				
		  },
		  cache: false
	
		});
	 }); //End of getlink button click

	 });  

	function blog_report(commentId, button){

		$.ajax({
			url : "index.php",
    		type : 'POST',
    		data : {
				module: 'ajax',
				act: 'blog',
				opt : 'comment',
				action: 'report-comment',
				comment_id: commentId,
				blog_id: <?php echo $_GET['id'];?>,
	    	
    		},
    		success: function(data){
        		if(data){
					newdata = $.parseJSON(data);
					if(newdata.type == 'success'){
						$.cookie('rc_'+commentId, '1', {expires: 30});
						$(button).html('Report bài viết (' + newdata.report_count + ')');
						$(button).attr('disabled', 'disabled');
						
					}
        		}
    		}
		});
	}

	function loadCommentHideHtml(){
		strCmt = '<div id="popup-wrap-comment-hide">\
			<textarea placeholder="Lý do ẩn"\
				class="blog-content-textarea form-control"\
				id="popup-comment-hide-content" name="popup-comment-hide-content" ></textarea>\
			<Br />\
			</div>';
			return strCmt;
	}

	function updateCommentHide(data){
		commentViewWrapper = $('#comment-'+data.id);
		topOffset = commentViewWrapper.offset().top - 10;
		$('html, body').animate({
	        scrollTop: topOffset
	    }, 300);

	    var i = setTimeout(function(){
	    	commentViewWrapper.find('.comment-content-view').html('');
	    	commentViewWrapper.css('box-shadow', '0').css('transition', 'box-shadow 1s').css('box-shadow', '0px 0px 30px #336699');
	    	
	    	var ii = setTimeout(function(){
	    		commentViewWrapper.css('transition', 'box-shadow 2s').css('box-shadow', '0px 0px 0px');
	    		commentViewWrapper.find('.comment-content-view').css('display', 'none').html(newdata.content_hide).fadeIn();
	    		
	    		/*var iii = setTimeout(function(){
	    			completeMessage = popupFuncMessage(["Ẩn bài viết thành công"], "alert-success");
	    			commentViewWrapper.find('.comment-content-view').append(completeMessage);
	    			
	    			commentViewWrapper.find('.alert-success').css('display', 'none').fadeIn().delay(2000).fadeOut();
					
		    	}, 500);*/
		    }, 500);
		}, 1000);
	}
	
	function blog_hide(commentId, that){
		console.log(that);
		btns = [{btnName:'Hoàn tất', btnClass:'btn-primary', btnId:'btn-submit-hide', btnOnClick: ''}];
		btnsArray = popupFuncButtons(btns);
		popupFunc("popup-comment-hide", "Ẩn bài viết", loadCommentHideHtml(), btnsArray, 'modal-md');

		$('#btn-submit-hide').on('click', function(){
			if($('#popup-comment-hide-content').val() == ""){
				completeMessage = popupFuncMessage(["Lý do ẩn không được để trống."], "alert-danger");
				replacePopupMessage("popup-comment-hide", completeMessage);
			}else{
				waitMessage = popupFuncMessage([loadLoadingImg('loading_bar.gif', null, 20) + " Đang xử lý..."], "alert-nobackground");
				replacePopupMessage("popup-comment-hide",waitMessage);
				$.ajax({
					url : "index.php",
		    		type : 'POST',
		    		data : {
						module: 'ajax',
						act: 'blog',
						opt : 'comment',
						action: 'hide-comment',
						comment_id: commentId,
						reason: $('#popup-comment-hide-content').val(),
						blog_id: <?php echo $_GET['id'];?>,
			    	
		    		},
		    		success: function(data){
			    		//console.log(data);
						if(data){
							newdata = $.parseJSON(data);
							console.log(newdata.type);
							if(newdata.type == 'success'){
								$('#popup-comment-hide').modal('hide');
								loadCommentContent(commentId, updateCommentHide);
								
								$(that).attr('onclick', 'blog_unhide('+commentId+',this)');
								$(that).html('<i class="fa fa-trash"></i>  Show bài viết');
								
								//blogCommentId;
								
							}else if(newdata.type == 'error'){
								alertClass = 'alert-danger';
								completeMessage = popupFuncMessage([newdata.message], alertClass);
								replacePopupMessage("popup-func-message", completeMessage);
							}
							
							
						}
			  		},
			 		cache: false
		
				});
			}
		});
		
		//loadCommentContent(commentId, loadCommentEdit);
			
	}

	
	
		function blog_unhide(commentId, that){
			$.ajax({
				url : "index.php",
	    		type : 'POST',
	    		data : {
					module: 'ajax',
					act: 'blog',
					opt : 'comment',
					action: 'unhide-comment',
					comment_id: commentId,
					blog_id: <?php echo $_GET['id'];?>,
		    	
	    		},
	    		success: function(data){
		    		if(data){
						newdata = $.parseJSON(data);
						console.log(newdata.type);
						if(newdata.type == 'success'){
							$('#popup-comment-hide').modal('hide');
							loadCommentContent(commentId, updateCommentView);
							$(that).attr('onclick', 'blog_hide('+commentId+',this)');
							$(that).html('<i class="fa fa-trash"></i> Ẩn bài viết');
						}
		    		}
		  		},
		  cache: false
	
		});
		return false;
	}

	

	function blog_edit(commentId){
		id = "popup-func-message";
		popTitle = "Sửa trả lời";
		loadCommentContent(commentId, loadCommentEdit, 'edit');
		//popupFunc(id, popTitle, message, btns);
	}

	function updateCommentView(data){
		console.log(data);
		commentViewWrapper = $('#comment-'+data.id);
		topOffset = commentViewWrapper.offset().top - 10;
		$('html, body').animate({
	        scrollTop: topOffset
	    }, 300);

	    var i = setTimeout(function(){
	    	commentViewWrapper.find('.blog-detail-sub-title').find('h2').html('');
	    	commentViewWrapper.find('.comment-content-view').html('');
	    	commentViewWrapper.css('box-shadow', '0').css('transition', 'box-shadow 1s').css('box-shadow', '0px 0px 30px #336699');
	    	var ii = setTimeout(function(){
	    		commentViewWrapper.css('transition', 'box-shadow 2s').css('box-shadow', '0px 0px 0px');
	    		commentViewWrapper.find('.blog-detail-sub-title').find('h2').css('display', 'none').html(newdata.name).fadeIn();
		    }, 300);
	    	var ii = setTimeout(function(){
	    		commentViewWrapper.find('.comment-content-view').css('display', 'none').html(newdata.content).fadeIn();
	    		if(commentViewWrapper.find('.blog_update_infor').length){
		    		//console.log(commentViewWrapper.find('.blog_update_infor').length);
	    			commentViewWrapper.find('.blog_update_infor').css('display', 'none').html("Cập Nhật lần cuối bởi <b>" + newdata.update_user + "</b> vào <em>" + newdata.update_time + "</em>").fadeIn();
	    		}else{
		    		//alert('here');
					commentViewWrapper.find('.manage-blog').prepend('<p class="pull-left blog_update_infor" style="font-size: 12px; padding: 3px 5px; color: #666;">Cập Nhật lần cuối bởi <b>' + newdata.update_user + '</b> vào <em>' + newdata.update_time + '</em></p>').fadeIn();
	    		}	
	    		//completeMessage = popupFuncMessage(["Update bài viết thành công"], "alert-success");
				//replacePopupMessage('comment-'+data.id, completeMessage);
		    }, 300);
		}, 1000);
	}


	function loadCommentEditHtml(data){
		strCmt = '<div id="popup-wrap-comment-edit"><input style="margin-bottom: 5px;" type="text" class="form-control blog-title-input"\
			value="'+data.name+'" id="popup_comment_tieude" />\
			<textarea placeholder="Content"\
				class="blog-content-textarea form-control"\
				id="popup-comment-content" name="popup-comment-content">'+data.content+'</textarea>\
			<div style="display: none">\
				<input type="text" class="form-control blog-title-input"\
					placeholder="Tiêu đề" id="blog_comment_conten" />\
			</div><Br />\
			</div>';
			return strCmt;
	}
	
	function loadCommentEdit(newdata){
	
		if(newdata.content){
			btns = [{btnName:'Hoàn tất', btnClass:'btn-primary', btnId:'btn-submit-edit', btnOnClick: ''}];
			btnsArray = popupFuncButtons(btns);
			popupFunc("popup-comment-edit", "Sửa bài viết", loadCommentEditHtml(newdata), btnsArray, 'modal-lg');
			
			tinymce.init({
				selector : '#popup-comment-content',
				 plugins : "advlist,autolink,lists,link,image,charmap,print,preview,table,image,fullscreen,code,paste,medialink,mediaurl,picasa_blog",
		  toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image print preview media | forecolor backcolor emoticons code fullscreen,paste | medialink,mediaurl | picasa_blog",
		  height:300,	paste_auto_cleanup_on_paste : true,
		paste_strip_class_attributes:false,
		paste_remove_styles:true,
		force_p_newlines : false,
		force_br_newlines : false,
	
      //  extended_valid_elements : "img[src|class|style],table[style|thead|tbody|tfoot|tr|td],div[style],p[style],ul[style],span[style],td[style],br",
	//	invalid_elements : "script,marquee,iframe,object,a" ,
	   extended_valid_elements : "table[style|thead|tbody|tfoot|tr|td|class],div[style],p[style],ul[style],span[style],td[style],br,img[src|class|style]",
	invalid_elements : "script,marquee,iframe,object,a" ,
	
		valid_child_elements : "strong/b/p/div/em/i/td[#text]",
		entity_encoding : "raw",
	    theme_advanced_resizing :true,
    	convert_urls: false
			}); //eND INIT TINYMCE


			// Khi click update comment
			$('#btn-submit-edit').on('click', function(){
				$.ajax({
					url : "index.php",
		    		type : 'POST',
		    		data : {
						module: 'ajax',
						act: 'blog',
						opt : 'comment',
						action : 'update-comment',
						comment_id: newdata.id,
						comment_name: $('#popup_comment_tieude').val(),
						comment_content: tinyMCE.get('popup-comment-content').getContent()
		    		},
		    		
					success: function(data){
						if(data){
							returnData = $.parseJSON(data);
							if(returnData.type == "success"){
								$('#popup-comment-edit').modal('hide');
								loadCommentContent(newdata.id, updateCommentView);
							}else{
								completeMessage = popupFuncMessage([returnData.message], "alert-danger");
								replacePopupMessage("popup-comment-edit", completeMessage);
							}
						}
					}
				});
			});
			
		}else{
			alertClass = 'alert-danger';
			completeMessage = popupFuncMessage([newdata.message], alertClass);
			replacePopupMessage("popup-func-message", completeMessage);
			//data = loadCommentContent(commentId);
		}
	}
	
	function loadCommentContent(commentId, callback, task){
		$.ajax({
			url : "index.php",
    		type : 'POST',
    		data : {
				module: 'ajax',
				act: 'blog',
				opt : 'comment',
				action : 'load-comment',
				comment_id:commentId,
				task : task
    		},
    		
			success: function(data){
				if(data){
					newdata = $.parseJSON(data);
					callback(newdata);
					
				}
			}
		});
	}

	

	/*function loadCommentContent(commentId){
		$.ajax({
			url : "index.php",
    		type : 'POST',
    		data : {
				module: 'ajax',
				act: 'blog',
				opt : 'comment',
				action : 'load-comment',
				comment_id:commentId,
				
    		},
    		
			success: function(data){
				if(data){
					newdata = $.parseJSON(data);
					//console.log(newdata.type);
					if(newdata.name && newdata.content){
						btns = [{btnName:'Hoàn tất', btnClass:'btn-primary', btnId:'btn-submit-edit', btnOnClick: ''}];
						btnsArray = popupFuncButtons(btns);
						popupFunc("popup-comment-edit", "Sửa bài viết", loadCommentEdit(newdata), btnsArray, 'modal-lg');
						
						tinymce.init({
						    selector : '#popup-comment-content',
							 plugins : "advlist,autolink,lists,link,image,charmap,print,preview,table,image,fullscreen,code,paste,picasa,smileys",
						  toolbar1: "paste,insertfile undo redo |  link image preview media smileys | code fullscreen ",
						  height:150,
						  	paste_auto_cleanup_on_paste : true,
						force_p_newlines : false,
						force_br_newlines : true,
						forced_root_block : '',
						extended_valid_elements : "img[src]",
						invalid_elements : "script,marquee,iframe,object,a,div,p,span" ,
						valid_child_elements : "strong/b/p/div/em/i/td[#text]",
					//	entity_encoding : "raw",
					    theme_advanced_resizing :false,
				    	convert_urls: false
						 }); //eND INIT TINYMCE
						
						
					}else if(newdata.type == 'error'){
						alertClass = 'alert-danger';
						completeMessage = popupFuncMessage([newdata.message], alertClass);
						replacePopupMessage("popup-func-message", completeMessage);
					}
					
					
				}
	  		},
	  		cache: false,
	  		
		});
	}*/
	
	function blog_delete(commentId){
		id = "popup-func-message";
		popTitle = "Xóa trả lời";
		btns = [{btnName:'Delete', btnClass:'btn-danger', btnId:'btn-submit-delete', btnOnClick: ''}];
		btnsArray = popupFuncButtons(btns);
		message = popupFuncMessage(["Bạn thực sự muốn xóa bài viết này ?"], "alert-danger");
		popupFunc(id, popTitle, message, btnsArray, 'modal-sm');
		
		$('#btn-submit-delete').on('click', function(){
			waitMessage = popupFuncMessage([loadLoadingImg('loading_bar.gif', null, 20) + " Đang xử lý..."], "alert-nobackground");
			replacePopupMessage(id,waitMessage);
			$.ajax({
				url : "index.php",
	    		type : 'POST',
	    		data : {
					module: 'ajax',
					act: 'blog',
					opt : 'delete',
					comment_id:commentId,
					blog_id:<?php echo $_GET['id'];?>,
	    		},
				success: function(data){
					if(data){
						newdata = $.parseJSON(data);
						console.log(newdata.type);
						if(newdata.type == 'success'){
							alertClass = 'alert-success';
							$('#' + id).modal('hide');
							blogCommentId = $('#comment-'+commentId);
							topOffset = blogCommentId.offset().top - 10;
							$('html, body').animate({
						        scrollTop: topOffset
						    }, 300);
						    
							completeMessage = popupFuncMessage([newdata.message], alertClass);
							//replacePopupMessage("popup-func-message", completeMessage);
							blogCommentId.html('').fadeIn().html(popupFuncMessage([newdata.message], alertClass)).delay(1000).fadeOut();
							commentId = null;
							
							//blogCommentId;
							
						}else if(newdata.type == 'error'){
							alertClass = 'alert-danger';
							completeMessage = popupFuncMessage([newdata.message], alertClass);
							replacePopupMessage("popup-func-message", completeMessage);
						}
						
						
					}
		  		},
		  		cache: false,
		  		
			});
		});
			
		return false;
	}	
</script>